<template>
  <div>
    <div class="container">
      <!-- 头部功能 -->
      <div class="search-header">
        <div class="headers">
          <div class="title">
            <span @click="add">&lt;</span>

            <span>自助找车</span>
            <router-link tag="span" to="/home" class="iconfont icon-zhuye"></router-link>
          </div>
          <div class="search">
            <router-link tag="div" to="/location" class="address">
              <span>地址</span>
              <span>请设置用车地址</span>
            </router-link>
            <p>

              <i></i>
              <span>上门送货</span>
            </p>
          </div>
          <div class="time">
            <div class="lease">
              <span>租期</span>
              
              <p>10月11日 18:30 - 10月13日 18:30</p>

            </div>
            <span class="days">2天</span>
          </div>
        </div>
      </div>
      <!-- 导航栏 -->
      <div class="nav">
        <div class="select">
          <van-tabs v-model="active" animated>
            <van-tab v-for="index in title" :key="index" :title="index">

              <LoveCar @shoucang="shoucang">{{ index }}</LoveCar>
              <!-- <twoCar></twoCar> -->
            </van-tab>
          </van-tabs>


        </div>

      </div>

    </div>
  </div>
</template>

<script>
import LoveCar from '@/components/LoveCar.vue';
// import twoCar from '@/components/twoCar.vue'
export default {
  data() {
    return {
      active: 0,
      title: ["最新车款", "今日上市", "当前热门", "今日上榜"],
      date: '',
      show: false,
    }
  },
  methods: {
    add(){
      this.$router.go(-1)
    },
 
    shoucang(flag) {
      if (flag) {
        this.collection.unshift(
          JSON.parse(window.localStorage.getItem("shoucang"))
        );
      } else {
        this.collection.splice(0, 1)
      }
    }
  },
  components: { LoveCar }
}
</script>

<style lang="scss">
/* 头部功能 */
.search-header {
  width: 100%;
  height: 168px;
  background-color: #303439;
  display: inline-block;

  .headers {
    width: 90%;
    margin: 0 auto;

    .title {
      width: 100%;
      height: 20px;
      margin-top: 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;

      span {
        font-size: 17px;
        color: #fff;
        font-weight: 600;

        &:nth-child(1) {
          font-family: "仿宋";
        }
      }
    }

    .search {
      width: 100%;
      height: 40px;
      margin-top: 20px;
      display: flex;
      justify-content: space-between;

      .address {
        width: 250px;
        height: 40px;
        background-color: #3d4147;
        border-radius: 3px;
        color: #fff;
        line-height: 40px;

        span {
          &:nth-child(1) {
            font-size: 13px;
            margin: 0 10px;
          }

          &:nth-child(2) {
            font-size: 14px;
            font-weight: 600;
          }
        }
      }

      p {
        color: #fff;
        line-height: 40px;
        font-size: 12px;
        display: flex;
        align-items: center;
        margin-right: 8px;

        i {
          display: inline-block;
          width: 15px;
          height: 15px;
          border-radius: 50%;
          background-color: #3d4147;
          margin-right: 6px;
        }
      }
    }

    .time {
      width: 100%;
      height: 40px;
      background-color: #3d4147;
      border-radius: 3px;
      margin-top: 15px;
      display: flex;
      align-items: center;
      justify-content: space-between;

      .lease {
        display: flex;
        color: #fff;
        font-size: 11px;

        span {
          margin: 0 10px;
        }

        p {
          font-weight: 600;
        }
      }

      .days {
        color: #fff;
        font-size: 11px;
        position: relative;
        margin-right: 10px;

        &::after {
          content: "";
          position: absolute;
          left: -10px;
          height: 11px;
          top: 20%;
          width: 1px;
          background: #7e8084;
        }
      }
    }
  }
}

/* 导航栏 */
.nav {
  width: 100%;
  // height: 95px;
  background-color: #fff;

  .select {
    width: 100%;
    height: 45px;
    border-bottom: 1px solid #edecec;

    ul {
      width: 90%;
      height: 100%;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;

      li {
        display: flex;
        font-size: 13px;
        align-items: center;
        height: 45px;

        .van-dropdown-menu__bar {
          height: 44px;
          box-shadow: none;

          .van-dropdown-menu__title {
            font-size: 13px;
            margin-right: 20px;
          }
        }

        em {
          display: block;
          width: 0;
          height: 0;
          border: 4px solid transparent;
          border-top-color: #868686;
          margin-left: 8px;
          margin-top: 8px;
        }

        // i {
        //   width: 9px;
        //   height: 11px;
        //   background: url('../assets/img/sjx.png');
        //   background-size: 100% 100%;
        //   margin-left: 8px;
        //   margin-top: 3px;
        // }
      }
    }
  }

  .filter {
    width: 100%;
    height: 50px;

    .filters {
      width: 90%;
      height: 100%;
      margin: 0 auto;
      display: flex;

      .sift {
        width: 65px;
        display: flex;
        align-items: center;
        font-size: 13px;
        position: relative;

        span {
          margin-left: 20px;
          margin-right: 8px;
        }

        em {
          width: 10px;
          height: 11px;
          background: url("../assets/img/ti.png");
          background-size: 100% 100%;
        }
      }

      ul {
        display: flex;
        align-items: center;

        li {
          width: 76px;
          height: 32px;
          background-color: #f5f5f5;
          border-radius: 3px;
          margin-left: 10px;
          text-align: center;
          line-height: 32px;
          font-size: 12px;
        }
      }
    }
  }
}

/* 汽车浏览 */
.carbox {
  width: 100%;
  background-color: #ebebeb;
  display: inline-block;

  .cars {
    width: 90%;
    margin: 0 auto;

    .car {
      width: 100%;
      height: 130px;
      margin-top: 10px;
      background-color: #fff;
      border-radius: 3px;
      display: flex;
      align-items: center;
      justify-content: space-around;

      .imgs {
        width: 150px;
        height: 110px;
        position: relative;

        img {
          width: 100%;
          height: 100%;
          border-top-left-radius: 5px;
        }

        em {
          &>img {
            width: 47px;
            height: 15px;
            position: absolute;
            top: 0;
            left: 0;
          }
        }
      }

      .content {
        width: 150px;
        height: 110px;
        display: flex;
        flex-direction: column;

        h1 {
          font-size: 14px;
          font-weight: 400;
          display: flex;
          margin-top: 8px;

          em {
            width: 17px;
            height: 17px;
            background: url("../assets/img/zi.png");
            background-size: 100% 100%;
            margin-top: 2px;
            margin-left: 5px;
          }
        }

        .plate {
          font-size: 10px;
          display: flex;
          justify-content: space-between;
          margin-top: 8px;

          span {
            &:nth-child(2) {
              margin-right: 10px;
            }
          }
        }

        .divide {
          font-size: 10px;
          color: #ffa41c;
          margin-top: 12px;
        }

        .ticket {
          font-size: 12px;
          display: flex;
          justify-content: space-between;
          margin-top: 8px;
          align-items: center;

          p {
            color: #f6a9c7;

            &>strong {
              font-size: 14px;
            }
          }
        }
      }
    }
  }
}
</style>